package com.example.layautsventana;

import com.example.transferencias.LogueoRespuesta;
import com.example.transferencias.SolicitudTransferencia;

import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;



/**
 * Activity which displays a login screen to the user, offering registration as
 * well.
 */
public class VentanaLogin extends Activity {
	
	

	// Values for email and password at the time of the login attempt.
	

	// UI references.
	private EditText txt_usuario;
	private EditText txt_clave;
	private Button btn_ingresar;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);        
		setContentView(R.layout.activity_ventana_login);
		
		txt_usuario = (EditText) findViewById(R.id.txt_cue_destino);

		txt_clave = (EditText) findViewById(R.id.txt_clave);

	
	
    btn_ingresar =(android.widget.Button) findViewById(R.id.btn_transfere);    
    btn_ingresar.setOnClickListener(new android.view.View.OnClickListener() {
		@Override
		public void onClick(View v) {
			// TODO Auto-generated method stub
			if(txt_usuario.getText().toString() != "" || txt_clave.getText().toString()!="")
			{
				SolicitudTransferencia sol_trans=new SolicitudTransferencia();
				
				
				android.content.Intent intento=new android.content.Intent(VentanaLogin.this,VentanaMenu.class);
				//intento.putExtra("param1",txt_usuario.getText().toString());
				intento.putExtra("param1",sol_trans.logueoBanco(txt_usuario.getText().toString(),txt_clave.getText().toString()));
				startActivity(intento);

				
			}
			else
			{
				
			}
		}
	});
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		super.onCreateOptionsMenu(menu);
		getMenuInflater().inflate(R.menu.ventana_login, menu);
		return true;
	}
}
